using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[System.Serializable]
public class UnitData{
    public string strFirstName;
    public string strNickName;
    public string strLastName;
	
    public int iUnitStatus;
    public int iSoldierType;
    public string strFaceName;
	
    public int iLevel;

    public int iChaos;

    public int iTraitPoint;

    public int iAtt;	//공격
    public int iDef;	//방어력
	
    public int iCurrentAtt;
    public int iCurrentDef;

    public bool m_bCoverd;
    public GameObject m_Cover;
	
    public int iHP; // 체력 능력치
    public int iMorale; // 사기 능력치


    public int iMaxHP;		//현재 채력
    public int iMaxMorale;	//현재 사기
    public int iCurrentHP;		//현재 채력
    public int iCurrentMorale;	//현재 사기

    public float fSightRange = 0.5f;    //시야
    public int iAccur = 5;		//명중률
    public int iStrength;
	
	
    public int iSpeedStat;
    public float fSpeed;		//속도 	

    public float fSpeedMin = 0.5f;
    public float fSpeedMax = 0.8f;
	
    public int iShootSpeed;	   //사격 속도 
    public float fCurrent_ShootSpeed;
	
    public float iDetect;		 //탐지
    public float fCurrentDetect; //현재 탐지

    public int iHavMagazine;    //가지고 있는 탄창
    

    //상태관련
    public BASEUNIT_STATE m_CurrentUnitState;
    public List<GameObject>   m_List_ConditionStrange = new List<GameObject>();

    public float fChatty; // 수다스러운 정도 ( 1이 표준, 0~2 사이)
    public float fCurChat;


    //레밸 관련 스탯
    public int iKillCount = 0;             //누적 킬 카운트
    public int iSuppressCount = 0;         //누적 제압 카운트
    public int iExp = 0;            //경험치
    public int iRank = 0;            //레밸

    // 사망관련
    public string strDeadMonth;
    public int iDeadDay;
    public int iDeadYear;
    public string strDeadReason;

    //퍽스탯 관련
    public int iBravePoint;
    public int iCowardPoint;


    public List<PerkData> ListPerk = new List<PerkData>();
    public TraitData[] arrayTrait;
    public List<int> iListBuff = new List<int>();
	
    public bool bTalking;

    public GameObject objNameTag;
	
	
    public ClassData ClassStatus;

    public void UnitData_Init()
    {
        iCurrentAtt = iAtt;
        iCurrentDef = iDef;

        iMaxHP =  100 + ((iHP-5) * 10);
        iCurrentHP = iMaxHP;

        iMaxMorale = 100 + ((iMorale - 5) * 10);
        iCurrentMorale = iMaxMorale;

        iChaos = 0;
    }

    public void SetRandSpeed()
    {
        int iSpeed = (int)(Random.Range(fSpeedMin, fSpeedMax));
        fSpeed = iSpeed * 0.1f;
    }

    public void SetDamage(int iDmg)
    {
        iCurrentHP -= iDmg;
    }
}
